package com.example.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.service.PaymentService;

@RestController
@RequestMapping("/payment")
public class PaymentController {

    @Autowired
    private PaymentService paymentService;

    @GetMapping("/synchronized")
    public String testSynchronized() {
        paymentService.synchronizedIncrement();
        return "synchronized increment done";
    }

    @GetMapping("/reentrantLock")
    public String testReentrantLock() {
        paymentService.reentrantLockIncrement();
        return "reentrantLock increment done";
    }
}    